<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>快速上手 | 中微子代理</title>
    <meta name="generator" content="VuePress 1.9.2">
    <link rel="icon" href="/neutrino-proxy-vuepress/img/favicon.ico">
    <meta name="description" content="一个基于 netty 的、开源的 java 内网穿透项目">
    <meta name="keywords" content="vuepress,theme,blog,vdoing">
    <meta name="theme-color" content="#11a8cd">
    
    <link rel="preload" href="/neutrino-proxy-vuepress/assets/css/0.styles.72eb1676.css" as="style"><link rel="preload" href="/neutrino-proxy-vuepress/assets/js/app.756733d0.js" as="script"><link rel="preload" href="/neutrino-proxy-vuepress/assets/js/2.4ec61f8d.js" as="script"><link rel="preload" href="/neutrino-proxy-vuepress/assets/js/6.4d153b6d.js" as="script"><link rel="prefetch" href="/neutrino-proxy-vuepress/assets/js/10.e844da0f.js"><link rel="prefetch" href="/neutrino-proxy-vuepress/assets/js/11.3926765d.js"><link rel="prefetch" href="/neutrino-proxy-vuepress/assets/js/12.57caf953.js"><link rel="prefetch" href="/neutrino-proxy-vuepress/assets/js/13.c2fbbac4.js"><link rel="prefetch" href="/neutrino-proxy-vuepress/assets/js/14.9fbad366.js"><link rel="prefetch" href="/neutrino-proxy-vuepress/assets/js/15.fbee2b43.js"><link rel="prefetch" href="/neutrino-proxy-vuepress/assets/js/16.27f8e12a.js"><link rel="prefetch" href="/neutrino-proxy-vuepress/assets/js/17.d525cdf7.js"><link rel="prefetch" href="/neutrino-proxy-vuepress/assets/js/18.d9a38399.js"><link rel="prefetch" href="/neutrino-proxy-vuepress/assets/js/19.d4edb52d.js"><link rel="prefetch" href="/neutrino-proxy-vuepress/assets/js/20.03d66876.js"><link rel="prefetch" href="/neutrino-proxy-vuepress/assets/js/21.619151c0.js"><link rel="prefetch" href="/neutrino-proxy-vuepress/assets/js/22.786c3745.js"><link rel="prefetch" href="/neutrino-proxy-vuepress/assets/js/23.9d9a0a68.js"><link rel="prefetch" href="/neutrino-proxy-vuepress/assets/js/24.7ec310f1.js"><link rel="prefetch" href="/neutrino-proxy-vuepress/assets/js/25.6c3f2489.js"><link rel="prefetch" href="/neutrino-proxy-vuepress/assets/js/26.2c5749ba.js"><link rel="prefetch" href="/neutrino-proxy-vuepress/assets/js/27.3a946426.js"><link rel="prefetch" href="/neutrino-proxy-vuepress/assets/js/28.4cd8aa66.js"><link rel="prefetch" href="/neutrino-proxy-vuepress/assets/js/3.9b2af462.js"><link rel="prefetch" href="/neutrino-proxy-vuepress/assets/js/4.1e281399.js"><link rel="prefetch" href="/neutrino-proxy-vuepress/assets/js/5.a958538c.js"><link rel="prefetch" href="/neutrino-proxy-vuepress/assets/js/7.7ea0385d.js"><link rel="prefetch" href="/neutrino-proxy-vuepress/assets/js/8.91d0a5fc.js"><link rel="prefetch" href="/neutrino-proxy-vuepress/assets/js/9.3494ec1e.js">
    <link rel="stylesheet" href="/neutrino-proxy-vuepress/assets/css/0.styles.72eb1676.css">
  </head>
  <body class="theme-mode-light">
    <div id="app" data-server-rendered="true"><div class="theme-container sidebar-open have-rightmenu"><header class="navbar blur"><div title="目录" class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/neutrino-proxy-vuepress/" class="home-link router-link-active"><img src="/neutrino-proxy-vuepress/img/logo.png" alt="中微子代理" class="logo"> <span class="site-name can-hide">中微子代理</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/neutrino-proxy-vuepress/" class="nav-link">首页</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="快速使用" class="dropdown-title"><a href="/neutrino-proxy-vuepress/pages/793dcb/" aria-current="page" class="link-title router-link-exact-active router-link-active">快速使用</a> <span class="title" style="display:none;">快速使用</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/neutrino-proxy-vuepress/pages/793dcb/" aria-current="page" class="nav-link router-link-exact-active router-link-active">快速上手</a></li><li class="dropdown-item"><!----> <a href="/neutrino-proxy-vuepress/pages/2f674a/" class="nav-link">目录结构</a></li><li class="dropdown-item"><!----> <a href="/neutrino-proxy-vuepress/pages/d0d7eb/" class="nav-link">Markdown 容器</a></li><li class="dropdown-item"><!----> <a href="/neutrino-proxy-vuepress/pages/197691/" class="nav-link">Markdown 中使用组件</a></li><li class="dropdown-item"><h4>相关文章</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/neutrino-proxy-vuepress/pages/8dfab5/" class="nav-link">使目录栏支持h2~h6标题</a></li><li class="dropdown-subitem"><a href="/neutrino-proxy-vuepress/pages/dd027d/" class="nav-link">如何让你的笔记更有表现力</a></li><li class="dropdown-subitem"><a href="/neutrino-proxy-vuepress/pages/2b8e22/" class="nav-link">批量操作front matter工具</a></li><li class="dropdown-subitem"><a href="/neutrino-proxy-vuepress/pages/0fc1d2/" class="nav-link">部署</a></li><li class="dropdown-subitem"><a href="/neutrino-proxy-vuepress/pages/9ae0bd/" class="nav-link">关于写文章和H1标题</a></li><li class="dropdown-subitem"><a href="/neutrino-proxy-vuepress/pages/26997d/" class="nav-link">关于博客搭建与管理</a></li><li class="dropdown-subitem"><a href="/neutrino-proxy-vuepress/pages/c5a54d/" class="nav-link">在线编辑和新增文章的方法</a></li></ul></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="常见问题" class="dropdown-title"><a href="/neutrino-proxy-vuepress/pages/a20ce8/" class="link-title">常见问题</a> <span class="title" style="display:none;">常见问题</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/neutrino-proxy-vuepress/pages/a20ce8/" class="nav-link">主题配置</a></li><li class="dropdown-item"><!----> <a href="/neutrino-proxy-vuepress/pages/f14bdb/" class="nav-link">首页配置</a></li><li class="dropdown-item"><!----> <a href="/neutrino-proxy-vuepress/pages/3216b0/" class="nav-link">front matter配置</a></li><li class="dropdown-item"><!----> <a href="/neutrino-proxy-vuepress/pages/54651a/" class="nav-link">目录页配置</a></li><li class="dropdown-item"><!----> <a href="/neutrino-proxy-vuepress/pages/1cc523/" class="nav-link">添加摘要</a></li><li class="dropdown-item"><!----> <a href="/neutrino-proxy-vuepress/pages/f51918/" class="nav-link">修改主题颜色和样式</a></li><li class="dropdown-item"><!----> <a href="/neutrino-proxy-vuepress/pages/ce175c/" class="nav-link">评论栏</a></li></ul></div></div><div class="nav-item"><a href="/neutrino-proxy-vuepress/pages/db78e2/" class="nav-link">演示</a></div><div class="nav-item"><a href="/neutrino-proxy-vuepress/pages/5d571c/" class="nav-link">案例</a></div><div class="nav-item"><a href="/neutrino-proxy-vuepress/pages/9cc27d/" class="nav-link">最近更新</a></div><div class="nav-item"><a href="/neutrino-proxy-vuepress/pages/1b12ed/" class="nav-link">关于我们</a></div> <a href="https://gitee.com/dromara/neutrino-proxy" target="_blank" rel="noopener noreferrer" class="repo-link">
    Gitee地址
    <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav></div></header> <div class="sidebar-mask"></div> <div class="sidebar-hover-trigger"></div> <aside class="sidebar" style="display:none;"><!----> <nav class="nav-links"><div class="nav-item"><a href="/neutrino-proxy-vuepress/" class="nav-link">首页</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="快速使用" class="dropdown-title"><a href="/neutrino-proxy-vuepress/pages/793dcb/" aria-current="page" class="link-title router-link-exact-active router-link-active">快速使用</a> <span class="title" style="display:none;">快速使用</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/neutrino-proxy-vuepress/pages/793dcb/" aria-current="page" class="nav-link router-link-exact-active router-link-active">快速上手</a></li><li class="dropdown-item"><!----> <a href="/neutrino-proxy-vuepress/pages/2f674a/" class="nav-link">目录结构</a></li><li class="dropdown-item"><!----> <a href="/neutrino-proxy-vuepress/pages/d0d7eb/" class="nav-link">Markdown 容器</a></li><li class="dropdown-item"><!----> <a href="/neutrino-proxy-vuepress/pages/197691/" class="nav-link">Markdown 中使用组件</a></li><li class="dropdown-item"><h4>相关文章</h4> <ul class="dropdown-subitem-wrapper"><li class="dropdown-subitem"><a href="/neutrino-proxy-vuepress/pages/8dfab5/" class="nav-link">使目录栏支持h2~h6标题</a></li><li class="dropdown-subitem"><a href="/neutrino-proxy-vuepress/pages/dd027d/" class="nav-link">如何让你的笔记更有表现力</a></li><li class="dropdown-subitem"><a href="/neutrino-proxy-vuepress/pages/2b8e22/" class="nav-link">批量操作front matter工具</a></li><li class="dropdown-subitem"><a href="/neutrino-proxy-vuepress/pages/0fc1d2/" class="nav-link">部署</a></li><li class="dropdown-subitem"><a href="/neutrino-proxy-vuepress/pages/9ae0bd/" class="nav-link">关于写文章和H1标题</a></li><li class="dropdown-subitem"><a href="/neutrino-proxy-vuepress/pages/26997d/" class="nav-link">关于博客搭建与管理</a></li><li class="dropdown-subitem"><a href="/neutrino-proxy-vuepress/pages/c5a54d/" class="nav-link">在线编辑和新增文章的方法</a></li></ul></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="常见问题" class="dropdown-title"><a href="/neutrino-proxy-vuepress/pages/a20ce8/" class="link-title">常见问题</a> <span class="title" style="display:none;">常见问题</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/neutrino-proxy-vuepress/pages/a20ce8/" class="nav-link">主题配置</a></li><li class="dropdown-item"><!----> <a href="/neutrino-proxy-vuepress/pages/f14bdb/" class="nav-link">首页配置</a></li><li class="dropdown-item"><!----> <a href="/neutrino-proxy-vuepress/pages/3216b0/" class="nav-link">front matter配置</a></li><li class="dropdown-item"><!----> <a href="/neutrino-proxy-vuepress/pages/54651a/" class="nav-link">目录页配置</a></li><li class="dropdown-item"><!----> <a href="/neutrino-proxy-vuepress/pages/1cc523/" class="nav-link">添加摘要</a></li><li class="dropdown-item"><!----> <a href="/neutrino-proxy-vuepress/pages/f51918/" class="nav-link">修改主题颜色和样式</a></li><li class="dropdown-item"><!----> <a href="/neutrino-proxy-vuepress/pages/ce175c/" class="nav-link">评论栏</a></li></ul></div></div><div class="nav-item"><a href="/neutrino-proxy-vuepress/pages/db78e2/" class="nav-link">演示</a></div><div class="nav-item"><a href="/neutrino-proxy-vuepress/pages/5d571c/" class="nav-link">案例</a></div><div class="nav-item"><a href="/neutrino-proxy-vuepress/pages/9cc27d/" class="nav-link">最近更新</a></div><div class="nav-item"><a href="/neutrino-proxy-vuepress/pages/1b12ed/" class="nav-link">关于我们</a></div> <a href="https://gitee.com/dromara/neutrino-proxy" target="_blank" rel="noopener noreferrer" class="repo-link">
    Gitee地址
    <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav>  <ul class="sidebar-links"><li><section class="sidebar-group depth-0"><p class="sidebar-heading open"><span>快速上手</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/neutrino-proxy-vuepress/pages/793dcb/" aria-current="page" class="active sidebar-link">快速上手</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level2"><a href="/neutrino-proxy-vuepress/pages/793dcb/#_1-打包" class="sidebar-link">1. 打包</a></li><li class="sidebar-sub-header level2"><a href="/neutrino-proxy-vuepress/pages/793dcb/#_2-部署" class="sidebar-link">2. 部署</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level3"><a href="/neutrino-proxy-vuepress/pages/793dcb/#_2-2-服务端部署" class="sidebar-link">2.2  服务端部署</a></li><li class="sidebar-sub-header level3"><a href="/neutrino-proxy-vuepress/pages/793dcb/#_2-4-管理后台部署" class="sidebar-link">2.4 管理后台部署</a></li></ul></li><li class="sidebar-sub-header level2"><a href="/neutrino-proxy-vuepress/pages/793dcb/#_3-配置" class="sidebar-link">3.配置</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level3"><a href="/neutrino-proxy-vuepress/pages/793dcb/#_3-1-配置端口池" class="sidebar-link">3.1  配置端口池</a></li><li class="sidebar-sub-header level3"><a href="/neutrino-proxy-vuepress/pages/793dcb/#_3-2-配置license" class="sidebar-link">3.2  配置License</a></li><li class="sidebar-sub-header level3"><a href="/neutrino-proxy-vuepress/pages/793dcb/#_3-3-配置端口映射" class="sidebar-link">3.3  配置端口映射</a></li><li class="sidebar-sub-header level3"><a href="/neutrino-proxy-vuepress/pages/793dcb/#_3-4-开启代理" class="sidebar-link">3.4  开启代理</a></li></ul></li><li class="sidebar-sub-header level2"><a href="/neutrino-proxy-vuepress/pages/793dcb/#_4-开发-调试" class="sidebar-link">4.开发&amp;调试</a></li><li class="sidebar-sub-header level2"><a href="/neutrino-proxy-vuepress/pages/793dcb/#_5-运行截图" class="sidebar-link">5.运行截图</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level3"><a href="/neutrino-proxy-vuepress/pages/793dcb/#用户管理" class="sidebar-link">用户管理</a></li><li class="sidebar-sub-header level3"><a href="/neutrino-proxy-vuepress/pages/793dcb/#端口池管理" class="sidebar-link">端口池管理</a></li><li class="sidebar-sub-header level3"><a href="/neutrino-proxy-vuepress/pages/793dcb/#license管理" class="sidebar-link">License管理</a></li><li class="sidebar-sub-header level3"><a href="/neutrino-proxy-vuepress/pages/793dcb/#端口映射管理" class="sidebar-link">端口映射管理</a></li><li class="sidebar-sub-header level3"><a href="/neutrino-proxy-vuepress/pages/793dcb/#客户端启动示例" class="sidebar-link">客户端启动示例</a></li></ul></li></ul></li><li><a href="/neutrino-proxy-vuepress/pages/2f674a/" class="sidebar-link">目录结构</a></li><li><a href="/neutrino-proxy-vuepress/pages/d0d7eb/" class="sidebar-link">Markdown 容器</a></li><li><a href="/neutrino-proxy-vuepress/pages/197691/" class="sidebar-link">Markdown 中使用组件</a></li></ul></section></li><li><section class="sidebar-group depth-0"><p class="sidebar-heading"><span>相关文章</span> <!----></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/neutrino-proxy-vuepress/pages/8dfab5/" class="sidebar-link">使目录栏支持h2~h6标题</a></li><li><a href="/neutrino-proxy-vuepress/pages/dd027d/" class="sidebar-link">如何让你的笔记更有表现力</a></li><li><a href="/neutrino-proxy-vuepress/pages/2b8e22/" class="sidebar-link">批量操作front matter工具</a></li><li><a href="/neutrino-proxy-vuepress/pages/0fc1d2/" class="sidebar-link">部署</a></li><li><a href="/neutrino-proxy-vuepress/pages/9ae0bd/" class="sidebar-link">关于写文章和一级标题</a></li><li><a href="/neutrino-proxy-vuepress/pages/26997d/" class="sidebar-link">关于博客搭建与管理</a></li><li><a href="/neutrino-proxy-vuepress/pages/c5a54d/" class="sidebar-link">在线编辑和新增文章的方法</a></li></ul></section></li></ul> </aside> <div><main class="page"><div class="theme-vdoing-wrapper "><div class="placeholder"></div> <!----> <div class="content-wrapper"><div class="right-menu-wrapper"><div class="right-menu-margin"><div class="right-menu-title">目录</div> <div class="right-menu-content"></div></div></div> <h1><img src="">快速上手<!----></h1> <div class="page-slot page-slot-top">
    <div class="wwads-cn wwads-horizontal page-wwads" data-id="136"></div>
    <style>
      .page-wwads{
        width:100%!important;
        min-height: 0;
        margin: 0;
      }
      .page-wwads .wwads-img img{
        width:80px!important;
      }
      .page-wwads .wwads-poweredby{
        width: 40px;
        position: absolute;
        right: 25px;
        bottom: 3px;
      }
      .wwads-content .wwads-text, .page-wwads .wwads-text{
        height: 100%;
        padding-top: 5px;
        display: block;
      }
  </style>
  </div> <div class="theme-vdoing-content content__default"><h2 id="_1-打包"><a href="#_1-打包" class="header-anchor">#</a> 1. 打包</h2> <p>可直接前往Gitee仓库发行版页面下载所需版本已打好的包。若需手动打包，则可参照下面的执行命令：</p> <div class="language-text extra-class"><pre class="language-text"><code># 服务端打包
mvn clean install -U -pl neutrino-proxy-server -am -Dmaven.test.skip=true

# 客户端打包
clean install -U -pl neutrino-proxy-client -am -Dmaven.test.skip=true

# 管理后台前端项目打包（本地环境，local改为dev则为dev环境，同时需要修改config目录下面的环境配置）
npm run build:local
</code></pre></div><h2 id="_2-部署"><a href="#_2-部署" class="header-anchor">#</a> 2. 部署</h2> <h3 id="_2-2-服务端部署"><a href="#_2-2-服务端部署" class="header-anchor">#</a> 2.2  服务端部署</h3> <ul><li>使用常规的jar包部署方式即可，如：java -jar xxxx</li></ul> <h3 id="_2-4-管理后台部署"><a href="#_2-4-管理后台部署" class="header-anchor">#</a> 2.4 管理后台部署</h3> <ul><li>Nginx方式部署（推荐）:</li></ul> <div class="language-conf extra-class"><pre class="language-text"><code>server {
        listen 9527;
        server_name localhost;

 #开启gzip
 gzip  on;
 #低于1kb的资源不压缩
 gzip_min_length 1k;
 #压缩级别1-9，越大压缩率越高，同时消耗cpu资源也越多，建议设置在5左右。
 gzip_comp_level 5;
 #需要压缩哪些响应类型的资源，多个空格隔开。不建议压缩图片.
 gzip_types text/plain application/javascript application/x-javascript text/javascript text/xml text/css;
 #配置禁用gzip条件，支持正则。此处表示ie6及以下不启用gzip（因为ie低版本不支持）
 gzip_disable &quot;MSIE [1-6]\.&quot;;
 #是否添加“Vary: Accept-Encoding”响应头
 gzip_vary on;

 location / {
            root  /work/projects/neutrino-proxy-server/neutrino-proxy-admin/dist;
            try_files $uri $uri/ /index.html;
            add_header Last-Modified $date_gmt;
 }
}
</code></pre></div><ul><li>无nginx时
在没有Nginx时，为了快速体验代理效果，可直接使用服务端项目提供的静态资源服务。直接将neutrino-proxy-admin打包后的文件解压放在neutrino-proxy-server.jar同级别目录下即可。例如：服务端配置的web端口为8080，则访问http://服务端IP:8080, 则会直接解析渲染neutrino-proxy-server.jar同级别目录下neutrino-proxy-admin/dist/index.html。</li></ul> <div class="custom-block warning"><p class="custom-block-title">注意</p> <p>需要注意的是，使用服务端自带的静态资源服务时，由于框架目前未支持缓存、gzip压缩，所以访问速度没有使用nginx快，正式使用推荐用nginx。</p></div> <h2 id="_3-配置"><a href="#_3-配置" class="header-anchor">#</a> 3.配置</h2> <h3 id="_3-1-配置端口池"><a href="#_3-1-配置端口池" class="header-anchor">#</a> 3.1  配置端口池</h3> <p>端口池的作用是将代理服务需要对外暴露的端口进行集中管理，方便安全组设置时统一操作。</p> <p>本项目为了简化首次配置，默认初始化数据会将9101～9120的所有端口加入端口池。可以在服务端项目sql配置(port_pool.data.sql文件)中自行修改初始化数据，也可以运行后在端口池管理页面手动维护。</p> <p>首次使用如果为了快速体验，建议直接使用默认端口池，则无需任何配置。</p> <h3 id="_3-2-配置license"><a href="#_3-2-配置license" class="header-anchor">#</a> 3.2  配置License</h3> <p>License是客户端连接代理服务端时所需要的唯一合法凭证，一个License同时只能被一个客户端使用。</p> <p>本项目为了简化首次配置，默认为每个用户初始化了一些license。可以在服务端项目sql配置(license.data.sql文件)中自行修改初始化数据，也可以运行后在License管理页面手动维护。</p> <p>首次使用如果为了快速体验，建议直接使用默认License，则无需任何配置。</p> <h3 id="_3-3-配置端口映射"><a href="#_3-3-配置端口映射" class="header-anchor">#</a> 3.3  配置端口映射</h3> <p>端口映射是代理的基本单元，一个外网端口在同一时刻被唯一的映射到一个内网IP+端口。所有流出该外网端口的流量都转发自对应的内网端口，同理所有流入该外网端口的流量都会转发到对应的内网端口。</p> <p>本项目为了简化首次配置，默认为每个用户初始化了一些端口映射。可以在服务端项目sql配置(port_mapping.data.sql文件)中自行修改初始化数据，也可以运行后在端口映射管理页面手动维护。</p> <p>首次使用如果为了快速体验，建议直接使用默认端口映射，则无需任何配置。</p> <h3 id="_3-4-开启代理"><a href="#_3-4-开启代理" class="header-anchor">#</a> 3.4  开启代理</h3> <p>上述步骤完成后，就可以开始代理自己的局域网设备了。</p> <p>比如现在有一个license：a123456，该license配置了一个或多个端口映射，其中包含9010到localhost:8080的映射（localhost表示代理客户端所在主机的端口，可以换成客户端所在局域网的任何IP）。此时修改客户端配置的服务端ip、license等启动客户端，就可以开启代理了，端口映射管理对应的记录在线状态为&quot;在线&quot;则证明代理成功建立。</p> <p>该license配置也可以通过客户端启动参数、启动后引导式输入、外置配置提供，为了简化首次体验门槛，这里直接提供一个外置配置模版：</p> <div class="language-json extra-class"><pre class="language-json"><code><span class="token punctuation">{</span>
 <span class="token property">&quot;jksPath&quot;</span><span class="token operator">:</span><span class="token string">&quot;classpath:/test.jks&quot;</span><span class="token punctuation">,</span>
 <span class="token property">&quot;licenseKey&quot;</span><span class="token operator">:</span><span class="token string">&quot;b0a907332b474b25897c4dcb31fc7eb6&quot;</span><span class="token punctuation">,</span>
 <span class="token property">&quot;serverIp&quot;</span><span class="token operator">:</span><span class="token string">&quot;localhost&quot;</span><span class="token punctuation">,</span>
 <span class="token property">&quot;serverPort&quot;</span><span class="token operator">:</span><span class="token number">9002</span><span class="token punctuation">,</span>
 <span class="token property">&quot;sslEnable&quot;</span><span class="token operator">:</span><span class="token boolean">true</span>
<span class="token punctuation">}</span>
</code></pre></div><p>修改上述json中的licenseKey，serverIp、serverPort、sslEnabled后，保存文件命名为<font color="#9b6e23">.neutrino-proxy-client.json</font>,放在客户端当前目录下（jar包启动时，放在jar包同级别目录下。idea启动时，放在项目根目录下），然后直接启动客户端。</p> <p>此时通过访问外网ip+端口，可以成功访问内网服务。通过此方式，可以代理任何基于TCP之上的协议，如：socket、websocket、http、ftp、ssh等。</p> <h2 id="_4-开发-调试"><a href="#_4-开发-调试" class="header-anchor">#</a> 4.开发&amp;调试</h2> <p>篇幅所限，此处不便赘述管理后台相关的开发，有vue基础的童鞋基本都可以自行开发。服务端的初始化数据足够调试工作，开发过程无需单独在管理页面操作。</p> <p>与SpringBoot项目类似，客户端、服务端项目均由一个入口类完成整个项目的启动，分别为ProxyClient、ProxyServer。</p> <p>内置配置采用yml风格，主要涉及Http端口、静态资源路径、协议参数、代理服务端端口、jks证书、数据源、license等。整个项目基于neutrino-core，风格类似于SpringBoot。笔者不喜欢因过分炫技而引入过多花式操作，因为项目的定位是个人开发者，且满足使用的同时兼顾学习其原理的需求。基本使用方式与SpringBoot类似，尽可能降低首次学习成本。</p> <p>neutrino-core项目test目录下包含众多核心封装的测试代码，通过调试这些代码，能尽可能减少大家学习的障碍。</p> <h2 id="_5-运行截图"><a href="#_5-运行截图" class="header-anchor">#</a> 5.运行截图</h2> <h3 id="用户管理"><a href="#用户管理" class="header-anchor">#</a> 用户管理</h3> <p><img src="/neutrino-proxy-vuepress/img/run-example/user-manager1.png"></p> <h3 id="端口池管理"><a href="#端口池管理" class="header-anchor">#</a> 端口池管理</h3> <p><img src="/neutrino-proxy-vuepress/img/run-example/port-pool1.png"></p> <h3 id="license管理"><a href="#license管理" class="header-anchor">#</a> License管理</h3> <p><img src="/neutrino-proxy-vuepress/img/run-example/license1.png"></p> <h3 id="端口映射管理"><a href="#端口映射管理" class="header-anchor">#</a> 端口映射管理</h3> <p><img src="/neutrino-proxy-vuepress/img/run-example/port-mapping1.png"></p> <h3 id="客户端启动示例"><a href="#客户端启动示例" class="header-anchor">#</a> 客户端启动示例</h3> <p><img src="/neutrino-proxy-vuepress/img/run-example/client-run1.png"></p></div></div>  <div class="page-edit"><!----> <!----> <div class="last-updated"><span class="prefix">上次更新:</span> <span class="time">2023/03/24, 13:16:58</span></div></div> <div class="page-nav-wapper"><div class="page-nav-centre-wrap"><!----> <a href="/neutrino-proxy-vuepress/pages/2f674a/" class="page-nav-centre page-nav-centre-next"><div class="tooltip">目录结构</div></a></div> <div class="page-nav"><p class="inner"><!----> <span class="next"><a href="/neutrino-proxy-vuepress/pages/2f674a/">目录结构</a>→
      </span></p></div></div></div> <!----></main></div> <div class="footer"><div class="icons"><a href="mailto:aoshiguchen@dromara.org" title="发邮件" target="_blank" class="iconfont icon-youjian"></a><a href="https://gitee.com/dromara/neutrino-proxy" title="Gitee" target="_blank" class="iconfont icon-gitee"></a><a href="https://github.com/aoshiguchen/neutrino-proxy" title="Github" target="_blank" class="iconfont icon-github"></a></div> 
  Theme by
  <a href="https://github.com/xugaoyi/vuepress-theme-vdoing" target="_blank" title="本站主题">Vdoing</a> 
    | Copyright © 2023-2023
    <span>傲世孤尘 | MIT License</span></div> <div class="buttons"><div title="返回顶部" class="button blur go-to-top iconfont icon-fanhuidingbu" style="display:none;"></div> <div title="去评论" class="button blur go-to-comment iconfont icon-pinglun" style="display:none;"></div> <div title="主题模式" class="button blur theme-mode-but iconfont icon-zhuti"><ul class="select-box" style="display:none;"><li class="iconfont icon-zidong">
          跟随系统
        </li><li class="iconfont icon-rijianmoshi">
          浅色模式
        </li><li class="iconfont icon-yejianmoshi">
          深色模式
        </li><li class="iconfont icon-yuedu">
          阅读模式
        </li></ul></div></div> <!----> <!----> <!----></div><div class="global-ui"></div></div>
    <script src="/neutrino-proxy-vuepress/assets/js/app.756733d0.js" defer></script><script src="/neutrino-proxy-vuepress/assets/js/2.4ec61f8d.js" defer></script><script src="/neutrino-proxy-vuepress/assets/js/6.4d153b6d.js" defer></script>
  </body>
</html>
